import cn.edu.cupk.*;

public class Main {
    public static void main(String[] args) {
        try{
            //readCarNameByXml()读取config.xml的carName标签内容，输出String类型列表
            for (String carName:new ReadXml("src//config.xml").readCarNameByXml()){
                ICarFactory carFactory;
                Class classReflection = Class.forName(carName);
                Object object = classReflection.getDeclaredConstructor().newInstance();
                carFactory = (ICarFactory)object;
                CarAbstract car = carFactory.produceCar();
                System.out.println(car.showInfo());
            }
    }catch (Exception e){
            e.printStackTrace();
        }
    }
}